package com.visikard.request;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import com.visikard.application.APIURL;
import com.visikard.application.VKregisterProperties;
import com.visikard.system.VKregisterConnects;
import com.visikard.utility.Utils;

public class AudienceRequest extends BaseRequest {

	public String getAudienceHistory(Long fkUser, long idCampaignSpecail, int pageIndex, int pageSize) throws Exception {
		String url = VKregisterConnects.getApiContextPathHttp() + APIURL.VKREGISTER_HISTORY_REDEEM_COUPON + fkUser
				+ "/" + idCampaignSpecail + "/" + pageIndex + "/" + pageSize;
		return Utils.getConnectValueFromURL(url);
	}

	public String getAudienceFriends(Long fkUser, String sessionID) throws Exception {
		// String url = VKregisterConnects.getApiContextPathHttp() + APIURL.AUDIENCE_TRADE_MERCHANT_VKREGISTER + fkUser
		// + "/" + sessionID;
		String url = "http://dev1.visikard.com/vk4v28/special/audience/traded/merchant/vkregister/34411/IETCK84OINLBB5OH1TOMCZAJG8HPOE1IYVXV3244";
		return Utils.getConnectValueFromURL(url);
	}

	public String sendAudienceToWallet(long uid, long idCampaignSpecail, String listfkUser, String listfkKard,
			int isBroadcast) throws Exception {
		List<NameValuePair> list = new ArrayList<NameValuePair>();

		list.add(new BasicNameValuePair("fkUserMerchant", String.valueOf(uid)));
		list.add(new BasicNameValuePair("idCampaignSpecail", "" + idCampaignSpecail));
		list.add(new BasicNameValuePair("listfkUser", listfkUser));
		list.add(new BasicNameValuePair("listfkKard", listfkKard));
		list.add(new BasicNameValuePair("isBroadcast", "" + isBroadcast));
		list.add(new BasicNameValuePair("keyStore", "" + VKregisterProperties.SERVER_KEYSTORE));

		return Utils.getPostConnectValueFromURL(APIURL.SPECIALS_AUDIENCE_SEND_TO_WALLET, list);
	}

	public String getRatingReview(Long fkUser, String idCampaignSpecail) throws Exception {
		String url = VKregisterConnects.getApiContextPathHttp() + APIURL.REPORT_RATING + fkUser + "/"
				+ idCampaignSpecail;
		return Utils.getConnectValueFromURL(url);
	}

	public String getListUserRating(String idCampaignSpecail, int pageIndex, int pageSize) throws Exception {
		String url = VKregisterConnects.getApiContextPathHttp() + APIURL.LIST_USER_RATING_COUPON + idCampaignSpecail
				+ "/" + pageIndex + "/" + pageSize;
		return Utils.getConnectValueFromURL(url);
	}

}
